<template>
  <div>
    <el-table
        :data="MyProject"
        style="width: 100%">
        <el-table-column
          prop="projectName"
          label="项目"
          >
        </el-table-column>
        <el-table-column
          prop="roleName"
          label="角色"
          >
        </el-table-column>

        <el-table-column label="操作">
          <template slot-scope="scope">
          <el-link  icon="el-icon-edit" @click="findDesc(scope.row.projectName)" type="primary">查看详情</el-link>
          <!-- <el-link  icon="el-icon-edit" @click="delrole(scope.row.roleNum)" type="primary">删除</el-link>

          <el-link icon="el-icon-edit" type="primary" @click="closeRole(scope.row.roleNum)">
          {{scope.row.roleState=='有效'?'禁用':'启用'}}
          </el-link> -->
          </template>
        </el-table-column>
        </el-table>

        <el-pagination
               fixed
               @size-change="handleSizeChange"
               @current-change="handleCurrentChange"
               :current-page="pages.current"
               :page-sizes="[1, 2, 3, 4]"
               :page-size="pages.size"
               layout="total, sizes, prev, pager, next, jumper"
               :total="pages.total">
             </el-pagination>
  </div>
</template>

<script>
  export default{
    name:"myproject",
    data(){
      return{
        MyProject:[],
        pages:{}
      }
    },
    methods:{
      getAllMyProject(current,size){
        this.$http.get("accountRoleProject/getMyProject",{
          params:{"current":current,
                  "size":size,
                   "accountId":JSON.parse(localStorage.getItem("loginUser")).accountId

          }
        }).then(resp=>{
          this.MyProject=resp.data.data.records
          this.pages=resp.data.data
        })
      },
      handleSizeChange(val){

        this.pages.size=val
        this.getAllMyProject(this.pages.num,val)
      },
      handleCurrentChange(val){
        this.pages.current=val
        this.getAllMyProject(val,this.pages.size)
          },
          findDesc(pname){
            localStorage.setItem("projectName",pname)
            this.$router.push("/myprojectdesc")
          }
    },
    created() {
      this.getAllMyProject(1,2)
    }
  }
</script>

<style>
</style>
